package feifei.service.impl;

import feifei.dao.UserDao;
import feifei.dao.impl.UserDaoImpl;
import feifei.pojo.User;
import feifei.service.UserService;

import java.util.ArrayList;

public class UserServiceImpl implements UserService {
    UserDao ud=new UserDaoImpl();
    @Override
    public User login(String name, String pwd) throws Exception {
        User u=null;
        String sql="select * from user where username='"+name+"' and password='"+pwd+"'";
        ArrayList<User> userList=ud.findUserBySql(sql);
        if(userList.size()>0) {
            u=userList.get(0);
        }
        return u;
    }
}
